﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Code.Models
{
    /// <summary>
    /// 登录的结果
    /// </summary>
    public enum LoginResult
    {
        /// <summary>
        /// 未知错误
        /// </summary>
        SysError=-5,
        /// <summary>
        /// 用户名不存在
        /// </summary>
        UnExist = -4,
        /// <summary>
        /// 未审核
        /// </summary>
        UnExamine = -3,
        /// <summary>
        /// 已锁定
        /// </summary>
        Locked = -2,

        /// <summary>
        /// 密码不正确
        /// </summary>
        PWDError = -1,

        /// <summary>
        /// 未激活
        /// </summary>
        UnActivate = 0,
        /// <summary>
        /// 成功
        /// </summary>
        Normal = 1,

    }

    public static class LoginResultEx
    {
        public static string GetName(this LoginResult result)
        {
            switch (result)
            { 
                case LoginResult.Normal:
                    return "正常";
                case LoginResult.PWDError:
                    return "密码不正确";
                case LoginResult.Locked:
                    return "账号已锁定";
                case LoginResult.UnActivate:
                    return "账号未激活";
                case LoginResult.UnExamine:
                    return "账号未审核";
                case LoginResult.UnExist:
                    return "用户名不存在";
                case LoginResult.SysError:
                    return "系统错误";
                default :
                    return ((int)result).ToString();
            } 
        }
    }
}
